<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<!-- 经纪人排行榜页面 -->
<body class="gray-bg" style="background-color: white;">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul >
							<li>
								交易类型：<select id ="moneyType"  name="moneyType" >
									<option selected = "selected" value="ALL">所有</option>
									<option value="FR">分润收益</option>
									<option value="SJ">升级收益</option>
								</select>
							</li>
							<!-- <li class="select-time">
								<label>查询时间： </label>
								<table>
									<tr>
										<td width="50%">
											<input type="text"  class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
										</td>
									</tr>
									<tr height="5"></tr>
									<tr>
										<td width="50%">
											<input type="text"  class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
										</td>
									</tr>
								</table>
							</li> -->
								<li class="select-time">
								<label>查询时间： </label>
								<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="searchSort()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>

						</ul>
					</div>	
						<!-- <table>
							<tr height="5"></tr>
							<tr>
								<td style="width: 30%">
									
								</td>
								<td style="width: 30%">
									
								</td>
							</tr>
							<tr></tr>
						</table> -->
				</form>
			</div>
			<br>
			<table id="msg_table">
				<tr >
					<td  style="background-color: yellow;"><strong>数据加载中,请耐心等待......</strong></td>
				</tr>
				<tr></tr>
			</table>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
				<br>
				<table id="sort_table" style="width: 80%"  border="1">
				</table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:merchantAgentAmount:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:merchantAgentAmount:remove')}]];
        $(function() {
        	 init();
        });
        function init(){
        	$("#msg_table").show();
        		$.ajax({
    				url : ctx + "system/hatchetMerchantForDLS/sortJJR", //经纪人排名
    				dataType : "json",
    				type : "POST",
    				
    				async : true,
    				success : function(re) {
    					$("#msg_table").hide();
    					var str = "";
    					 str += "<tr >";
    					 str += "<td align='center'><strong>用户排名</strong></td>";
    					 str += "<td align='center'><strong>用户名称</strong></td>";
    					 if(!isPhone()){
    						 str += "<td align='center'><strong>用户编号</strong></td>";
    	   					 str += "<td align='center'><strong>用户手机</strong></td>";
    					 }
    					 str += "<td align='center'><strong>用户收益(元)</strong></td>";
    					 str += "</tr>";
    					
    					$.each(re, function(i,v) {
    					str += "<tr>";
    					str += "<td  align='center'>"+(i+1)+"</td>";	
    					str += "<td  align='center'>"+v.merchantCnName+"</td>";	
    					if(!isPhone()){
    						 str += "<td  align='center'>"+v.merchantNo+"</td>";	
        					str += "<td  align='center'>"+v.phone+"</td>";	
    					}
    					
    					str += "<td  align='center'>"+v.sumMoney+"</td>";	
    					str += "</tr>"
    					});
    					$("#sort_table").html(str);
    				}
    			});
        	} 
        
       		 function searchSort(){
       			$("#sort_table").html("");
       			$("#msg_table").show();
        		$.ajax({
    				url : ctx + "system/hatchetMerchantForDLS/sortJJR", //经纪人排名
    				dataType : "json",
    				type : "POST",
    				data:{
    					"startTime":$("#startTime").val(),
    					"endTime":$("#endTime").val(),
    					"moneyType":$("#moneyType").val()
    				},
    				async : true,
    				success : function(re) {
    					$("#msg_table").hide();
    					var str = "";
    					str += "<tr>";
	   					 str += "<td align='center'><strong>用户排名</strong></td>";
	   					 str += "<td align='center'><strong>用户名称</strong></td>";
	   					 if(!isPhone()){
    						 str += "<td align='center'><strong>用户编号</strong></td>";
    	   					 str += "<td align='center'><strong>用户手机</strong></td>";
    					 }
	   					 str += "<td align='center'><strong>用户收益(元)</strong></td>";
	   					 str += "</tr>";
    					$.each(re, function(i,v) {
    					str += "<tr>";
    					str += "<td  align='center'>"+(i+1)+"</td>";	
    					str += "<td  align='center'>"+v.merchantCnName+"</td>";	
    					 if(!isPhone()){
    						 str += "<td  align='center'>"+v.merchantNo+"</td>";	
         					str += "<td  align='center'>"+v.phone+"</td>";	
    					 }
    					str += "<td  align='center'>"+v.sumMoney+"</td>";	
    					str += "</tr>"
    					});
    					$("#sort_table").html(str);
    				}
    			});
        	}
       	//判断当前浏览器是否为手机 
       	function isPhone(){
	       	 var sUserAgent = navigator.userAgent.toLowerCase();  
	       	 var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";   
	       	 var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";       
	       	 var bIsMidp = sUserAgent.match(/midp/i) == "midp"; 
	       	 var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; 
	       	 var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";    
	       	 var bIsAndroid = sUserAgent.match(/android/i) == "android";  
	       	 var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";  
	       	 var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";        
	       	 if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) { 
	       		 return true;//是手机
	     	   } else {  
	     		return false; //是pc
	     	   }
       	}	 
    </script>
</body>
</html>